<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2018/12/10
 * Time: 10:11
 */

namespace app\crm\model;


class Withdrawal extends BaseModel
{
    public static function alipayTransfer($info)
    {
        import('alipay.aop.AopClient', EXTEND_PATH, '.php');
        import('alipay.aop.request.AlipayFundTransToaccountTransferRequest', EXTEND_PATH, '.php');
        $aop = new \AopClient ();
        $aop->gatewayUrl = 'https://openapi.alipay.com/gateway.do';
        $aop->appId = '2018120562488352';
        $aop->rsaPrivateKey = 'MIIEpAIBAAKCAQEAqbf67nVoUH1fcEpkWuriQlGSknKPiir9wv0e4e2hq04ulMfS05qNiP4exjCfJWtF+DSKVN7qCWEbODHy4h3kAQdwyIian8UZMsKdHBOCAuctxuPecBEZqApov5EbAeSlLXg+59LRNCPDNnvi8IqfI02/zkLBER5HcDPIaXEhQ+emVx7si8UKFv2E0fp/5oWbirTsJu9F4EhZzyooCXD9Ee991z0u5cRAAZHgKwff7uTKfrkiC1fl8/sXLFXP4wysAGdJa7BEtLVakZhXiQOg+XDzP7ct+NoFlfTjyq1SjXLaj6ifOvcJkUDqOX57wHhtJlLKkoVPBJ8ffup5+V0V3wIDAQABAoIBAA0pytmR25xajPttmaj/jLruDrszDXT+7p2f+jQ1tRNPRgeeE/j7hLy6UPK4NK+3ST79/Dim7Wn60Ryjqx3kiZmW1SWIis2XgOPR+lOCI9RLz94cMFVqzh2daRBqlbio3jLPn7llPXqYx3xDUY+sgLlBP34k6UqFma7XJV UgRB87CPNFIxWrzeqXcQc8/cckonX8+zKgK+QXNO6lOty4TZ1VLDy/dQb3xNk8FLWDMqntFIXwukNRk+1Bk66OwBxhMmdLrlXluisJntyl+IIjCQ+6CWigZIGfNoeFOHibCxUtykqYETX5CqmA9vz1moNlC85Wn14gfjGAiYVHK06snRkCgYEA0RlFK2/aXWnvza6oY8rcnhAJYJFYHNDY9oGOlj/0TyOwQ1CPOPFtj9sT2Qh6xsRfnhHBcsCvolHbYpqH5Zltbn0b346ugYy1QLU9iDQI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M4+WsAjN82sfPZJ40v0KNWalKZJmpYAQTqKjHLZFA9DntjE4eqnEaVI3Vx0ajQz6sBarsb6ilXBtNY5nE3lEMxFIdtZBpGQIDAQAB';
        $aop->apiVersion = '1.0';
        $aop->signType = 'RSA2';
        $aop->postCharset = 'UTF-8';
        $aop->format = 'json';
        $request = new \AlipayFundTransToaccountTransferRequest ();
        $request->setBizContent("{" .
            "\"out_biz_no\":\"{$info['order_no']}\"," .
            "\"payee_type\":\"ALIPAY_LOGONID\"," .
            "\"payee_account\":\"{$info['alipay']}\"," .
            "\"amount\":\"{$info['amount']}\"," .
            "\"payer_show_name\":\"余额提现\"," .
            "\"payee_real_name\":\"{$info['realname']}\"," .
            "\"remark\":\"余额提现\"" .
            "  }");
        $result = $aop->execute($request);
        dump($result);
        exit;
        $responseNode = str_replace(".", "_", $request->getApiMethodName()) . "_response";
        $resultCode = $result->$responseNode->code;
        if (!empty($resultCode) && $resultCode == 10000) {
            echo "成功";
        } else {
            echo "失败";
        }
    }

    //提现订单查询

}